#include("../../comm/ListHead.html")
<style>
    #bar_desc span{ color:#ffb466 }
</style>
<div class="layui-fluid layui-anim layui-anim-scale">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="card-search SearchTable">
                    <div style="float:right">

                        <div class="layui-inline layui-input-wrap">
                            <span class="layui-input-prefix"><i class="layui-icon layui-icon-user"></i></span>
                            <input type="text" id="login_id" lay-verify="required" placeholder="登陆帐号" autocomplete="off"
                                   lay-affix="clear" class="table-search-text width120">
                        </div>

                        <div class="layui-inline layui-input-wrap">
                            <span class="layui-input-prefix"><i class="layui-icon layui-icon-username"></i></span>
                            <input type="text" id="user_name" lay-verify="required" placeholder="姓名" autocomplete="off"
                                   lay-affix="clear" class="table-search-text width120">
                        </div>

                        <input type="text" id="login_ip" lay-verify="required" placeholder="登陆IP" autocomplete="off"
                               class="table-search-text width150">
                        <button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="DoSearch">
                            搜索
                        </button>
                    </div>

                    <i class="layui-icon layui-icon-slider"></i>
                    <span class="layui-breadcrumb">
                        <a>当前位置</a>
                        <a>系统在线用户</a>
                    </span>
                </div>
                <div class="layui-card-body">
                    <table class="layui-hide" id="table_1" lay-filter="table_1"></table>

                    <script type="text/html" id="table_1_bar_title">
                        <div><i class="layui-icon">&#xe770;</i><span id="bar_desc"></span></div>
                    </script>
                    <script type="text/html" id="table_1_bar_page">
                        <div><i class="layui-icon layui-icon-tips"></i></div>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<script language="JavaScript">

    layui.use(['myTable', 'table', 'form', 'util', 'myTool'], function () {
        var $ = layui.$;
        myTable = layui.myTable, table = layui.table
        form = layui.form, util = layui.util, myTool = layui.myTool;

        tableindex = myTable.render({
            url: 'SysOnlineListDataApi'
            , title: '在线用户列表'
            , cols: [[
                {type: 'checkbox', width: 36, fixed: true, hide: true}
                , {type: 'numbers', width: 50, title: '序号'}
                , {field: 'sess_id', title: '会话编号', width: 150}
                , {field: 'emp_id', title: '用户ID', width: 80, align: 'center'}
                , {field: 'login_id', title: '登陆帐号', width: 100}
                , {field: 'user_name', title: '姓名', width: 70}
                , {field: 'login_ip', title: '登陆IP', width: 120}
                , {field: 'login_addr', title: '登陆地址', width: 150}
                , {field: 'login_os', title: '操作系统', width: 80}
                , {field: 'login_browser', title: '浏览器', width: 100}
                , {field: 'times', title: '在线时长', width: 70, align: 'center', color: '#5FB9FF'}
                , {field: 'last_login', title: '最后登陆', width: 160, hide: true, sort: true}
                , {field: 'last_active', title: '最后活动', width: 160, sort: true}
                , {field: '', title: '备注'}
            ]]
            , page: true, limit: 15
            , serviceSort: true, initSort: {field: 'last_active', type: 'desc'}
            , editField: {url: 'ModifySysOnlineFieldApi', key: 'emp_id'}
            , done: function (res, curr, count) {
                $("#bar_desc").html(res.msg);
            }
        });
        //搜索
        util.event("lay-event", {
            DoSearch: function () {
                tableindex.reload({
                    where: {
                        s: {login_ip: $("#login_ip").val()},
                        like: {login_id: $("#login_id").val(), user_name: $("#user_name").val()}
                    }
                    , page: {curr: 1}
                });
            }
        });
    });
</script>
#include("../../comm/Foot.html")